﻿using System;
using System.Collections;
using System.Data;
using System.IO;
using System.Reflection;
using System.Configuration;
using IBatisNet.DataMapper.Configuration;
using IBatisNet.Common; // DataSource definition
using IBatisNet.Common.Utilities; // ScriptRunner definition
using IBatisNet.DataMapper; // SqlMap API
using System.Collections.Specialized;

namespace Scenario.WorkflowEngine.Scheduler.Jobs
{
    public class JobController
    {
        private static JobController _jobController = null;
        private Hashtable vJobs = new Hashtable();

        public JobController()
        {
        }

        public static JobController Instance()
        {
            if (_jobController == null)
            {
                lock (typeof(JobController))
                {
                    if (_jobController == null) // double-check
                    {
                        _jobController = new JobController();
                    }
                }
            }
            return _jobController;
        }

        public bool AddJob(String jobName)
        {
            lock (typeof(JobController))
            {
                if (vJobs.ContainsKey(jobName))
                    return false;

                vJobs.Add(jobName, false);
                return true;
            }
        }

        public void RemoveJob(String jobName)
        {
            lock (typeof(JobController))
            {
                vJobs.Remove(jobName);
            }
        }

    }
}